
//
//  NSDate+Interval.m
//  FunnyVideo
//
//  Created by 李鑫 on 15/10/30.
//  Copyright © 2015年 NewEggTech. All rights reserved.
//
#define TIMERADIX 60
#import "NSDate+Interval.h"

@implementation NSDate (Interval)

- (BOOL)biggerThanLgInterval:(NSUInteger)lgMin_interval{
    return YES;
}
- (NSString *)minuteToNowAndLargestInterval:(NSUInteger)lgMin_interval{
    NSUInteger currentInterval = [self timeIntervalSinceNow];
    
    NSUInteger lgSec_Interval = lgMin_interval*TIMERADIX;
    
    if(currentInterval <= lgSec_Interval)
    {
        return [NSString stringWithFormat:@"%ld分钟前",currentInterval/TIMERADIX];
    }
    
    //否则 进行转换时间
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    
    dateFormatter.dateFormat = @"MM月dd日 HH:mm";
    
    return [dateFormatter stringFromDate:self];
}


@end
